import {NativeModules,NativeEventEmitter} from 'react-native'

const {BleModule} = NativeModules

let eventEmitter = new NativeEventEmitter(BleModule)


export default class BleUtil {

    static init(listener){

        BleModule.init()
        eventEmitter.addListener('BLE_EVENT',listener)
    }

    static startScan(isSkin = true){
        return BleModule.startScan(isSkin)
    }

    static getDeviceInfo(){
        //返回值说明 isConnect : 是否连接到设备
        // nurseState : 美肤状态 0=init,1=paused,2=running ,wifiSsid : WiFi的ssid
        return BleModule.getDeviceInfo();
    }

    /*
    *   param: {strategy:"", recordId:1,age:20,autoModeParam:[1,2] }
    */
    static startCareSkin(param){
        BleModule.startCareSkin(param)
    }

    static pauseCareSkin(){
        BleModule.pauseCareSkin();
    }

    static continueCareSkin(){
        BleModule.continueCareSkin();
    }

    static finishCareSkin(){
        BleModule.finishCareSkin();
    }
}
